﻿{% extends "app/layout.html" %}

{% block style %}
<link rel="stylesheet" href="{% static 'prism/prism.css' %}">
{% endblock %}
{% block content %}
    <div>
        <div class="container">
            <div class="row">
                <div class="col-md-8">
                    {% ifnotequal stype 1 %}
                    <ul class="breadcrumb">
	                    <li><a href="/blog/">博客</a></li>
                        {% ifequal stype 0 %}
	                    <li class="active">所有</li>
                        {% endifequal %}
                        {% ifequal stype 2 %}
	                    <li class="active">标签</li>
	                    <li class="active">{{ stxt }}</li>
                        {% endifequal %}
                        {% ifequal stype 3 %}
	                    <li class="active">类别</li>
	                    <li class="active">{{ stxt }}</li>
                        {% endifequal %}
                    </ul>
                    {% endifnotequal %}
                    {% autoescape off %}
                    {% for b in blogs %}
                    <article>
                        <div class="page-header">
                            <a href="/blog?stype=1&skey={{ b.id }}"><h1>{{ b.title }} <small>{{ b.create_time|date:'Y-n-d' }}</small></h1></a>
                        </div>
                        {% if islist %}
                        <p>{{ b.lead }}</p>
                        {% else %}
                        <p>{{ b.content }}</p>
                        {% endif %}
                    </article>
                    {% endfor %}
                    {% endautoescape %}
                    {% if islist %}
                    <nav style="text-align:center">
                        <ul class="pagination">
                            {% for p in pages.paginator.page_range %}
                            {% ifequal p pages.number %}
                            <li class="active"><a href="#" onclick="return false;">{{ p }}</a></li>
                            {% else %}
                            <li><a href="{{ urlextra }}{{ p }}">{{ p }}</a></li>
                            {% endifequal %}
                            {% endfor %}
                        </ul>
                    </nav>
                    {% endif %}
                </div>
                <div class="col-md-4">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">类别</h3>
                        </div>
                        <div class="panel-body">
                            <ul>
                                {% for t in categories %}
                                <li><a href="/blog?stype=3&skey={{ t.id }}">{{ t.name }}</a></li>
                                {% endfor %}
                            </ul>
                        </div>
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">标签</h3>
                        </div>
                        <div class="panel-body">
                            <ul>
                                {% for t in tags %}
                                <li><a href="/blog?stype=2&skey={{ t.id }}">{{ t.name }}</a></li>
                                {% endfor %}
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
{% block scripts %}
<script src="{% static 'prism/prism.js' %}"></script>
<script>
  $('pre').addClass("language-cpp").addClass("line-numbers").css("white-space", "pre-wrap");
</script>
{% endblock %}